New owners now can be created properly.
[RRRRHHHH_Code] / ruralHouses client / src / gui / listOfOwnerAddittionRequests.java
index 9e1b6a3..1d78a53 100644 (file)
@@ -106,23 +106,22 @@ public class listOfOwnerAddittionRequests extends JFrame {
                                        
                                        try {
                                                acm = (AccountInterface) Naming
-                                                               .lookup(___IntNames.AdminManager);
+                                                               .lookup(___IntNames.AccountManager);
                                        } catch (Exception e1) {
                                                System.out.println("Error accessing remote authentication: "
                                                                + e1.toString());
                                        }
-                                       Account accou = accounts.get(table.getSelectedRow());
+
                                        try {
-                                               acm.addAccount(accou);
-                                               am.removeOwnerAdditionRequests(accou);
+                                               acm.addAccount(table.getSelectedRow());
+                                               am.removeOwnerAdditionRequests(table.getSelectedRow());
                                                am.saveInstance();
                                        } catch (RemoteException e1) {
                                                // TODO Auto-generated catch block
                                                e1.printStackTrace();
                                        }
                        
-                                       ((DefaultTableModel)table.getModel()).removeRow(accounts.indexOf(accou));
-                                       accounts.remove(accou);
+                                       ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
                                }
                        }
                });
@@ -133,17 +132,16 @@ public class listOfOwnerAddittionRequests extends JFrame {
                btnDenyAddition.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent arg0) {
                                if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
-                                       Account acc = accounts.get(table.getSelectedRow());
                                        try {
-                                               am.removeOwnerAdditionRequests(acc);
+                                               am.removeOwnerAdditionRequests(table.getSelectedRow());
                                                am.saveInstance();
                                        } catch (RemoteException e) {
                                                // TODO Auto-generated catch block
                                                e.printStackTrace();
                                        }
                                        
-                                       ((DefaultTableModel)table.getModel()).removeRow(accounts.indexOf(acc));
-                                       accounts.remove(acc);
+                                       ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
+                                       accounts.remove(table.getSelectedRow());
                                }
                        }
                });